package com.ss.android.article.base.feature.model;

import android.text.TextUtils;
import java.io.Serializable;
import org.json.JSONException;
import org.json.JSONObject;

public class UgcUser implements Serializable {
    public String authInfo;
    public String authType;
    public String avatar_url;
    public String description;
    public boolean follow;
    public boolean isLoading;
    public String name;
    public String user_auth_info;
    public long user_id;
    @Deprecated public boolean user_verified;
    public String verified_content;

    public UgcUser() {
        this.authType = "0";
        this.authInfo = "";
    }

    public static JSONObject extractFromUgcUser(UgcUser arg6) {
        String v3_1;
        int v3;
        String v4;
        JSONObject v0;
        int v1 = 1;
        if(arg6 == null) {
            v0 = null;
            return v0;
        }

        v0 = new JSONObject();
        try {
            v0.put("avatar_url", arg6.avatar_url);
            v0.put("name", arg6.name);
            v0.put("description", arg6.description);
            v0.put("user_id", arg6.user_id);
            v4 = "user_verified";
            if(arg6.user_verified) {
                v3 = 1;
            } else {
                v3 = 0;
            }
            v0.put(v4, v3);
            v0.put("verified_content", arg6.verified_content);
            v0.put("user_auth_info", arg6.user_auth_info);
            v3_1 = "follow";
            if(!arg6.follow) {
                v1 = 0;
            }
            v0.put(v3_1, v1);
        }
        catch(JSONException v1_1) {
            v1_1.printStackTrace();
        }

        return v0;
    }

    public static UgcUser extractFromUserInfoJson(JSONObject arg8) {
        UgcUser v0_4;
        UgcUser v3;
        boolean v0_1;
        UgcUser v4;
        boolean v1 = true;
        int v5 = -1;
        if(arg8 == null) {
            v4 = null;
            return v4;
        }

        v4 = new UgcUser();
        v4.avatar_url = arg8.optString("avatar_url");
        v4.name = arg8.optString("name");
        v4.description = arg8.optString("description");
        v4.user_id = arg8.optLong("user_id");
        int v0 = arg8.optInt("user_verified", v5);
        if(v0 == v5) {
            v0_1 = arg8.optBoolean("user_verified", false);
            v3 = v4;
        }
        else if(v0 != 0) {
            v0_1 = true;
            v3 = v4;
        }
        else {
            v0_1 = false;
            v3 = v4;
        }

        v3.user_verified = v0_1;
        v4.verified_content = arg8.optString("verified_content");
        v4.user_auth_info = arg8.optString("user_auth_info");
        if(!TextUtils.isEmpty(v4.user_auth_info)) {
            try {
                JSONObject v0_3 = new JSONObject(v4.user_auth_info);
                v4.authInfo = v0_3.optString("auth_info");
                v4.authType = v0_3.optString("auth_type");
            }
            catch(JSONException v0_2) {
                v0_2.printStackTrace();
            }
        }

        v0 = arg8.optInt("follow", v5);
        if(v0 == v5) {
            v1 = arg8.optBoolean("follow", false);
            v0_4 = v4;
        }
        else if(v0 != 0) {
            v0_4 = v4;
        }
        else {
            v1 = false;
            v0_4 = v4;
        }

        v0_4.follow = v1;
        return v4;
    }

    public boolean isUserVerified() {
        boolean v0 = !TextUtils.isEmpty(this.user_auth_info) ? true : false;
        return v0;
    }
}

